<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Wechatoffiaccountsauthorization extends Model
{
    protected $table = 'wechat_offiaccounts_authorization';
    protected $primaryKey = 'id';
    
    public static function wechatOffiaccountsAuthorizationByAppid($appid)
    {
        return self::where("appid",$appid)->orderBy("id","DESC")->first();
    }

    public static function wechatOffiaccountsAuthorizationInsert($appid,$authorizer_access_token,$authorizer_refresh_token)
    {
        return self::insert(["appid"=>$appid,"authorizer_access_token"=>$authorizer_access_token,"authorizer_refresh_token"=>$authorizer_refresh_token,"created_at"=>time()]);
    }
}